package com.ruoyi.workflow.service.impl;

import java.util.List;

import com.ruoyi.workflow.domain.ApprovalRecords;
import com.ruoyi.workflow.dto.ApprovalRecordsDto;
import com.ruoyi.workflow.mapper.ApprovalRecordsMapper;
import com.ruoyi.workflow.service.IApprovalRecordsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.text.Convert;

/**
 * 审批记录Service业务层处理
 *
 * @author 周志雄
 * @date 2024-03-15
 */
@Service
public class ApprovalRecordsServiceImpl implements IApprovalRecordsService
{
    @Autowired
    private ApprovalRecordsMapper approvalRecordsMapper;

    /**
     * 查询审批记录
     *
     * @param recordId 审批记录主键
     * @return 审批记录
     */
    @Override
    public ApprovalRecords selectApprovalRecordsByRecordId(Long recordId)
    {
        return approvalRecordsMapper.selectApprovalRecordsByRecordId(recordId);
    }

    /**
     * 查询审批记录列表
     *
     * @param approvalRecords 审批记录
     * @return 审批记录
     */
    @Override
    public List<ApprovalRecords> selectApprovalRecordsList(ApprovalRecords approvalRecords)
    {
        return approvalRecordsMapper.selectApprovalRecordsList(approvalRecords);
    }

    /**
     * 新增审批记录
     *
     * @param approvalRecords 审批记录
     * @return 结果
     */
    @Override
    public int insertApprovalRecords(ApprovalRecords approvalRecords)
    {
        return approvalRecordsMapper.insertApprovalRecords(approvalRecords);
    }

    /**
     * 修改审批记录
     *
     * @param approvalRecords 审批记录
     * @return 结果
     */
    @Override
    public int updateApprovalRecords(ApprovalRecords approvalRecords)
    {
        return approvalRecordsMapper.updateApprovalRecords(approvalRecords);
    }

    /**
     * 批量删除审批记录
     *
     * @param recordIds 需要删除的审批记录主键
     * @return 结果
     */
    @Override
    public int deleteApprovalRecordsByRecordIds(String recordIds)
    {
        return approvalRecordsMapper.deleteApprovalRecordsByRecordIds(Convert.toStrArray(recordIds));
    }

    @Override
    public ApprovalRecords selectByApplyId(String applyId) {
        return approvalRecordsMapper.selectByApplyId(applyId);
    }

    /**
     * 根据条件获取审批记录列表
     *
     * @param processType
     * @param id
     * @return
     */
    @Override
    public List<ApprovalRecordsDto> selectByCondition(String processType, String id) {
        return approvalRecordsMapper.selectByCondition(processType,id);
    }

    /**
     * 删除审批记录信息
     *
     * @param recordId 审批记录主键
     * @return 结果
     */
    @Override
    public int deleteApprovalRecordsByRecordId(Long recordId)
    {
        return approvalRecordsMapper.deleteApprovalRecordsByRecordId(recordId);
    }
}
